def Gcd(a, b):
    """
    Compute GCD using Euclidean algorithm
    http://en.wikipedia.org/wiki/Euclidean_algorithm
    """
    while a != 0:
        b, a = a, b % a
    return b

